package com.suning.sawp.service.impl.dao.task;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.suning.framework.dal.client.DalClient;
import com.suning.sawp.dto.task.RegionTaskPercentBean;
import com.suning.sawp.intf.dao.task.RegionTaskPercentDaoService;
import com.suning.sawp.po.task.RegionTaskPercent;

@Service
public class RegionTaskPercentDaoServiceImpl implements RegionTaskPercentDaoService{

    @Resource
    DalClient dalClient;
    
    @Override
    public RegionTaskPercent queryRegionPercent(Integer taskNo, String regionCode) {
        Map<String,Object> paramMap = new HashMap<String,Object>();
        paramMap.put("taskNo", taskNo);
        paramMap.put("regionCode", regionCode);
        return dalClient.queryForObject("REGION_TASK_PERCENT.QUERY_BY_CON", paramMap, RegionTaskPercent.class);
    }

    @Override
    public void batchInsertRegionTask(Map<String, Object>[] parmMap) {
        dalClient.batchUpdate("REGION_TASK_PERCENT.INSERT", parmMap);
    }

    @Override
    public List<RegionTaskPercentBean> queryRegionPercentList(Integer taskNo) {
        Map<String,Object> paramMap = new HashMap<String,Object>();
        paramMap.put("taskNo", taskNo);
        return dalClient.queryForList("REGION_TASK_PERCENT.QUERY_BY_CON", paramMap,RegionTaskPercentBean.class);
    }

    @Override
    public int updateRegionPercent(Integer Id, Integer percent) {
        Map<String,Object> paramMap = new HashMap<String,Object>();
        paramMap.put("percent", percent);
        paramMap.put("condition_Id", Id);
        return dalClient.execute("REGION_TASK_PERCENT.UPDATE_BY_ID", paramMap);
    }

    @Override
    public List<RegionTaskPercentBean> queryRegionPercentInfo(Integer taskNo) {
        Map<String,Object> paramMap = new HashMap<String,Object>();
        paramMap.put("taskNo", taskNo);
        return dalClient.queryForList("REGION_TASK_PERCENT.QUERY_RELATE_INFO", paramMap,RegionTaskPercentBean.class);
    }

    @Override
    public void batchUpdate(Map<String, Object>[] parmMap) {
        dalClient.batchUpdate("REGION_TASK_PERCENT.UPDATE_BY_ID", parmMap);
    }

    @Override
    public List<String> queryRegionPercent(Integer taskNo) {
        Map<String,Object> paramMap = new HashMap<String,Object>();
        paramMap.put("taskNo", taskNo);
        return dalClient.queryForList("REGION_TASK_PERCENT.QUERY_REGION_PERCENT", paramMap,String.class);
    }

}
